//配置路由的地方
import Vue from 'vue';
import VueRouter from 'vue-router';
// import store from '@/store';
//使用插件
Vue.use(VueRouter);
//引用路由组件

let originPush = VueRouter.prototype.push;
//重写push/replace
VueRouter.prototype.push = function (location, resolve, reject) {
    if (resolve && reject) {
        originPush.call(this, location, resolve, reject);
    } else {
        originPush.call(this, location, () => {
        }, () => {
        });
    }
}

//配置路由
let router = new VueRouter({
    routes: [
        {
            //智慧党建
            path: '/home',
            name: 'home',
            component: () => import('@/views/home/index'),
            meta: {
                show: true
            }
        },
        {
            //智慧招商
            path: '/attractinvest',
            name: 'attractinvest',
            component: () => import('@/views/attractinvest/index'),
            meta: {
                show: true
            }
        },
        {
            //环境监测
            path: '/monitor',
            name: 'monitorIndex',
            redirect: '/monitor/environment',
            component: () => import('@/views/monitor/index'),
            children: [
                {
                    path: '/monitor/air',
                    name: 'monitorAir',
                    component: () => import('@/views/monitor/air/index'),
                    meta: {
                        show: true
                    }
                },
                {
                    path: '/monitor/contaminated',
                    name: 'monitorContaminated',
                    component: () => import('@/views/monitor/contaminated/index'),
                    meta: {
                        show: true
                    }
                },
                {
                    path: '/monitor/environment',
                    name: 'monitorEnvironment',
                    component: () => import('@/views/monitor/environment/index'),
                    meta: {
                        show: true
                    }
                },
            ]
        },
        {
            //综合态势
            path: '/',
            name:"synthesis",
            component: () => import('@/views/synthesis/index'),
            meta: {
                show: true
            }
        },
        {
            // 经济运行
            path: '/economy',
            name:"economy",
            component: () => import('@/views/economy/index'),
            meta: {
                show: true
            }
        },
        {
            // 能耗监测
            path: '/consumption',
            name:"consumption",
            component: () => import('@/views/consumption/index'),
            meta: {
                show: true
            }
        },
        {
            // 安全监管
            path: '/safety',
            name:"safety",
            component: () => import('@/views/safety/index'),
            meta: {
                show: true
            }
        },
        {
            // 安全监管
            path: '/traffic',
            name:"traffic",
            component: () => import('@/views/traffic/index'),
            meta: {
                show: true
            }
        }
    ]
})

export default router;
